<template>
	<view class="">
		<!-- #ifdef H5 -->
		<view class="zdex9 pt20 pb20" :style="{ backgroundImage: 'url(' + cosImageUrl('head_bg.png',true) + ')' }">
			<view class="flex alicen pl20 h60">
				<view class="w40b flex alicen">
					<u-icon name="arrow-left" color="#070707" size="18" @click="goback()"></u-icon>
					<view class="fz24 ml20 nowrap">指点教育高考预测系统</view>
				</view>
			</view>
		</view>
		<!-- #endif -->
		
		<!-- #ifdef MP-WEIXIN -->
		<view class="zdex9 pb20" style="background-color: transparent;"
			:style="{ backgroundImage: 'url(' + cosImageUrl('head_bg.png',true) + ')' }">
			<view class="">
				<view class="" :style="{'paddingTop':statusBarHeigh + 'px',}">
					<view class="flex alicen pl20" :style="{'height':menuButtonInfo.height + 'px',}">
						<view class="w40b">
							<u-icon name="arrow-left" color="#070707" size="18" @click="goback()"></u-icon>
						</view>
					</view>
				</view>
			</view>
		</view>
		<!-- #endif -->
		<scroll-view scroll-y="true" class="ollHeight">
			<view class="pt20 pl20 pr20">
				<view class="fz28 bold mb20">学校简介</view>
				<view class="bg0055ff pt20 relative pl20 pr20 pl20 pb20 ius10 flex alicen">
					<view class="absolute  pr10 pl30 alicen flex  h60 bgsize100b no-repeat t0 r0"
						:style="{ backgroundImage: 'url(' + cosImageUrl('bage.png',true) + ')' }">
						<text class="fz24 bold colff">{{reArr[0]&&reArr[0].submitRate||'--'}}%</text>
					</view>
					<image class="w180 h180" :src="imgurl+school.slogo" mode="aspectFill">
					</image>
					<view class="ml10 colff w70b">
						<view class="flex alicen between w90b fz28">
							<view class="flex alicen">
								<view class="">{{school.sname||'--'}}</view>
								<view class="ml8">({{school.scode||'--'}})</view>
							</view>
							<view class="">投档概率</view>
						</view>
						<view class="fz20 mt10 mb10">
							<text>教育行政主管部门</text>
							<text class="pl8 pr8 ius10 colff ">{{school.sdepartment||'--'}}</text>
						</view>
						<!-- <view class="fz20 mt">
							<text>院校特性:</text>
							<text
								class=" pl8 pr8 ius10 colff mr10 border1 ml8 boreb">{{removeSpanTags(school.collegeLevel)}}</text>
						</view> -->
						<view class="fz20 mt10">
							<text>所在省份:{{school.schoolAreadto&&school.schoolAreadto.provinceName||'--'}}</text>
							<text>所在地:{{school.schoolAreadto&&school.schoolAreadto.cityName||'--'}}</text>
						</view>
						<view class="fz20 mt10">
							<text>官方电话:{{school.smodel||'--'}}</text>
						</view>
					</view>
				</view>
				<mp-html style="font-size:24rpx;" :content="school.scontent" />
				<view class="mt10 mb20 col33 fz20">{{school.remark||'--'}}</view>
				<view class="flex alicen">
					<view class="fz30 bold">院校实力排名(供参考)</view>
					<view class=" pl20 ml10 pr20 ius10 colff bg0055ff flexCenter">{{reArr[0]&&reArr[0].sranking}}</view>
				</view>
				<view class="flex overauto alicen mb20 mt20">
					<view class="fz30 bold nowrap">专业组</view>
					<view @click="showmajor(item,z)" class=" pl20 ml10 pr20 ius10  flexCenter"
						v-for="(item,z) in zyzArr" :key="z" :class="item.zyz == school.zyz?'colff bg0055ff':'col00'">
						{{item.zyz}}
					</view>
				</view>
				
				<view class="fz20 mt10 pb20">
					<text>{{member.memo}}</text>
				</view>
				
				<view class="flex  fz20 border1  boreb">
					<view class="w12-5b pt20 pb20  flexCenter bdl1-left1 boreb">再选科目</view>
					<view class="w12-5b pt20 pb20 flexCenter bdl1-left1 boreb">年份</view>
					<view class="w12-5b  pt20 pb20  flexCenter bdl1-left1 boreb">分数线</view>
					<view class="flex alicen w50b">
						<view class="w25b h100b bdl1-left1 boreb">
							<view class="h50b w100b flexCenter bgff000 colff txtcen">录取最低分</view>
							<view class="h50b w100b flexCenter bg0055ff colff txtcen">最低分排位</view>
						</view>
						<view class="w25b h100b ">
							<view class="h50b w100b flexCenter bgff000 colff txtcen">您的同位分</view>
							<view class="h50b w100b flexCenter bg0055ff colff txtcen">您的名次</view>
						</view>
						<view class="w25b h100b ">
							<view class="h50b w100b flexCenter bgff000 colff txtcen">录取平均分</view>
							<view class="h50b w100b flexCenter bg0055ff colff txtcen">平均分名次</view>
						</view>
						<view class="w25b h100b ">
							<view class="h50b w100b flexCenter bgff000 colff txtcen">计划招生数</view>
							<view class="h50b w100b flexCenter bg0055ff txtcen colff ">录取数</view>
						</view>
					</view>
					<view class="flexCenter w12-5b   bdl1-left1  boreb">收藏</view>
				</view>
				<schollTable :list="reArr" @favorite="favorite"></schollTable>

				<view class="fz20 mt10 mb10"> <text class="col40">温馨提示:</text> 院校或专业录取数据未满三年的,系统显示的概率会有偏差,请自行分析或咨询老师。
				</view>
				<view class="" v-for="(item2,index2) in zyList" :key="index2">
					<view class="flex between pt20 pb20 alicen">
						<view class=" fz24 alicen w90b">
							<view class="flex alicen">
								<view class="nowrap">专业名称:{{item2.major||'--'}}</view>
								<view class="nowrap ml10">排名: <text class="col359eff">{{item2.majorPm||'--'}}</text>
								</view>
							</view>
							<view class="flex alicen">
								<view class="nowrap ml10">今年计划招生 <text
										class="col359eff">{{item2.thisYearMajorPlanStr||'--'}}</text> 人</view>
								<view class="nowrap ml10">录取概率 <text
										class="col359eff">{{item2.submitRate||'--' }}%</text></view>
							</view>
						</view>
						<u-icon @tap.stop="favorite(item2)" name="star" color="#ff0000" size="24"></u-icon>
					</view>
					<com-table :hander_list="hander_list" :tableItem="item2" str="scroll"></com-table>
				</view>
			</view>
		</scroll-view>
	</view>
</template>

<script>
	import {
		province_list,
		school_level,
		school_types
	} from "@/utils/api/dict.js"
	import selectList from "./selectList.vue";
	import searchView from "./searchView.vue";
	import baseInfoList from "./baseInfoList.vue";
	import {
		zhfx_detail
	} from "@/utils/api/generateWish.js"
	import schollTable from "@/pages/schoolDetail/schollTable.vue";
	export default {
		components: {
			searchView,
			baseInfoList,
			schollTable
		},
		data() {
			return {
				currZyz: 0, //当前的专业组
				imgurl: 'https://gaokao.zdwljy.com/web-api',
				school: {}, //学校信息
				member: {}, //成员信息
				reArr: [], //再选科目数组
				zyList: [], //专业数组
				zyzArr: [], //专业组
				list: [],
				popObj: {
					popTypeName: "",
					popTypeValue: "",
					showRightPop: false,
					popTitle: "",
					popList: [],
					isLoad: {}
				},
				hander_list: [{
						name: '年份'
					},
					{
						name: '当年计划数',
						text: '当年录取数'
					},
					{
						name: '录取最低分',
						text: '最低分排位'
					},
					{
						name: '您的同位分',
						text: '您的排位'
					},
					{
						name: '录取平均分',
						text: '平均分名次'
					},
				],
				params: {}
			};
		},
		onLoad(options) {
			if (options.params) {
				this.params = JSON.parse(options.params)
				this.getPageInfo()
			}
		},
		// scrolltolower() {
		// 	this.showloading();
		// 	this.model1.searchInfo.pageNum++
		// 	this.getPageInfo()
		// },
		methods: {
			//请求详情
			async getPageInfo(isReset = true) {
				let detail = await zhfx_detail(this.params)
				if (detail.code == 200) {
					this.school = detail.data.school //学校数据
					this.member = detail.data.member //成员信息
					this.reArr = this.processzxkm(detail.data.returnList)
					this.zyzArr = detail.data.zyzList
					this.zyList = this.processreArr(detail.data.zyList)
					console.log('学校信息',this.zyList)
				}
			},
			async favorite(item) {
				let params = {
					schoolCode: item.scode,
					zyz: item.zyz,
					userId: this.readData('useId')
				}
				let favres = await this.request.get('/api/addMyFavorite', {
					params
				})
				if (favres.code == 200) {
					this.successToShow(favres.msg)
				}
			},
			selectProvince() {
				this.popObj.popTypeName = "provinceName"
				this.popObj.popTypeValue = "province"
				province_list("").then(res => {
					let temp = []
					res.map((item) => {
						let obj = {
							name: item.name,
							value: item.id
						}
						temp.push(obj)
					})
					this.popObj.popList = temp
					this.popObj.isLoad["selectList"] = true
					this.popObj.showRightPop = true
				})
			},
			//切换专业组
			async showmajor(item, index) {
				if (this.school.zyz == item.zyz) return;
				this.school.zyz = item.zyz
				let params = {
					schoolCode: this.school.scode,
					zyz: item.zyz,
					userId: this.readData('useId')
				}
				let major = await this.request.get('/api/showByZyz', {
					params
				})
				if (major.code == 200) {
					this.zyList = []
					this.reArr = []
					this.zyList = this.processreArr(major.data.zyList)
					this.reArr = this.processzxkm(major.data.returnList)
					this.member = major.data.member
				}
			},
			submitPop(item) {
				this.popObj.popTypeName = null
				this.popObj.popTypeValue = null
				this.popObj.popTitle = null
				this.popObj.popList = []
				this.popObj.isLoad = {}
				this.popObj.showRightPop = false
				if (item.popTypeName && item.popTypeValue) {
					this.model1.searchInfo[item.popTypeName] = item.val.name
					this.model1.searchInfo[item.popTypeValue] = item.val.value
				}
			},
			majorSeriesChange(item, index) {
				var that = this
				that.majorSeriesCurrent = index
			},
			submitPop(item) {
				this.popObj.popTypeName = null
				this.popObj.popTypeValue = null
				this.popObj.popTitle = null
				this.popObj.popList = []
				this.popObj.isLoad = {}
				this.popObj.showRightPop = false
				if (item.popTypeName && item.popTypeValue) {
					this.model1.searchInfo[item.popTypeName] = item.val.name
					this.model1.searchInfo[item.popTypeValue] = item.val.value
				}
			},
			majorSeriesChange(item, index) {
				var that = this
				that.majorSeriesCurrent = index
			},
			//收藏事件
			async favorite(e) {
				let params = {
					schoolCode: this.school.scode,
					zyz: this.zyzArr[this.currZyz].zyz,
					userId: this.readData('useId')
				}
				let favres = await this.request.get('/api/addMyFavorite', {
					params
				})
				if (favres.code == 200) {
					this.successToShow(favres.msg)
				}
			}
		},

	}
</script>

<style lang="less">
	.ollHeight {
		height: calc(100vh - 120rpx);
		overflow: auto;
	}

	.table {
		display: block;
	}

	.cell {
		flex: 1;
		padding: 10px;
		border: 1px solid #000;
		text-align: center;
	}
</style>